package com.xzh.mallorderapi.service;

import com.mall.common.util.JsonResult;
import com.xzh.mallorderspi.model.AddressDao;
import com.xzh.mallorderspi.model.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;

@FeignClient(value="mall-gateway",contextId = "order-user-api")
public interface UserServiceClient {

    @GetMapping("/api/user/get/{userId}")
    JsonResult<UserDTO> getUserById(@PathVariable("userId") Long userId);

    @GetMapping("/api/address/get/{userId}/{addressId}")
    JsonResult<AddressDao> getAddressById(@PathVariable("userId") Long userId,
                              @PathVariable("addressId") String addressId);

    @GetMapping("/api/user/deductAccountBalance/{memberId}/{totalPay}")
    JsonResult<Boolean> deductAccountBalance(@PathVariable("memberId") Long memberId,
                                             @PathVariable("totalPay") BigDecimal totalPay);

    @GetMapping("/api/user/addAccountBalance/{memberId}/{totalPay}")
    JsonResult<Boolean> addAccountBalance(@PathVariable("memberId") Long memberId,
                                          @PathVariable("totalPay") BigDecimal totalPay);
}

